// 基站管理接口api
import { fetch } from '@/utils/fetch.js';

/* 组合班-创建组班接口
 * @param {Object} params
 * schoolId / initGrade
 */
export function addZb(params) {
  return fetch({
    url: '/usercenter/admin/school/classes/add_group_class',
    method: 'POST',
    data: params,
  });
}

/* 组合班-编辑组班接口
 * @param {Object} params
 * schoolId / initGrade / classId
 */
export function editZb(params) {
  return fetch({
    url: '/usercenter/admin/school/classes/edit_group_class',
    method: 'POST',
    data: params,
  });
}

/* 班级管理-保存学生
 * @param {Object} params
 */
export function zbSaveStudents(params) {
  return fetch({
    url: '/usercenter/admin/school/student/save',
    method: 'POST',
    data: params,
  });
}

/* 组合班-班级详情接口,用于编辑回显
 * @param {Object} params
 */
export function getGroupDetail(params) {
  return fetch({
    url: '/usercenter/admin/school/classes/group_class_detail',
    method: 'POST',
    data: params,
  });
}

/* 班级管理-学校各个年级下学生统计
 * @param {Object} params
 * classType: 班级类型：normal-正常班；group组班
 */
export function getGradeStudent(params) {
  return fetch({
    url: '/usercenter/admin/school/gradeStudentStatistics',
    method: 'POST',
    data: params,
  });
}

/* 班级管理-年级下各个班级学生统计
 * @param {Object} params
 * grade: 年级id
 * classType: 班级类型：normal-正常班；group组班
 */
export function getClassListStudent(params) {
  return fetch({
    url: '/usercenter/admin/school/classes/gradeClassesStatistics',
    method: 'POST',
    data: params,
  });
}

/* 学校年级班级学生树
 * @param {Object} params
 * layer: 查询范围 （1-查询到年级；2-查询到班级；3-查询到学生）
 * schoolId
 */
export function getSchoolTree(params) {
  return fetch({
    url: '/usercenter/admin/school/student/tree',
    method: 'POST',
    data: params,
  });
}

/* 组合班-编辑学生数据接口（添加学生保存）
 * @param {Object} params
 * schoolId
 */
export function updateGroupStudent(params) {
  return fetch({
    url: '/usercenter/admin/school/classes/update_group_class_student',
    method: 'POST',
    data: params,
  });
}

/* 组合班-编辑组班详情页-已分配学生列表
 * @param {Object} params
 * schoolId
 */
export function getClassStudentLists(params) {
  return fetch({
    url: '/usercenter/admin/school/student/group_student_lists',
    method: 'POST',
    data: params,
  });
}

/* 组合班-学生详情分页列表
 * @param {Object} params
 * classId
 * currPage
 * pageSize
 * className
 */
export function getGroupStudentList(params) {
  return fetch({
    url: '/usercenter/admin/school/student/group_student_list',
    method: 'POST',
    data: params,
  });
}

/* 组合班-学生退出组班
 * @param {Object} params
 * classId
 * studentId
 */
export function quitGroup(params) {
  return fetch({
    url: '/usercenter/admin/school/student/exit_group_student',
    method: 'POST',
    data: params,
  });
}

/* 组班-对应学校列表
 * @param {Object} params
 * classId
 * studentId
 */
export function getSchoolListByClass(params) {
  return fetch({
    url: '/usercenter/admin/school/lists_by_group_class',
    method: 'POST',
    data: params,
  });
}

/* 组班管理-导出学生
 * @param {Object} params
 * classId
 * studentId
 */
export function exportZbList(params) {
  return fetch({
    url: '/usercenter/admin/export/group_student_lists',
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

/* 已开通学校列表-不分页
 * @param {Object} params
 * classId
 * studentId
 */
export function getAllOpenSchoolList(params) {
  return fetch({
    url: '/usercenter/admin/school/open_lists',
    method: 'POST',
    data: params,
  });
}
